package day04;

public class Ex1{
	public static void main(String[]args){
		//int[] a = {-2,-1,-3,-5,-4,-6,-7,-8,-9,-10};
		int[] a = new int[10];
		for(int i=0; i<a.length; i++){
			a[i] = (int)(Math.random()*10);
			System.out.print(a[i]+" ");
		}
		System.out.println();
		/*
		int max = a[0];
		for(int i=0; i<a.length; i++){
			if(max<a[i]){
				max = a[i];
			}
		}
		int min = a[0];
		for(int i=0; i<a.length; i++){
			if(min>a[i]){
				min = a[i];
			}
		}
		int sum = 0;
		for(int i=0; i<a.length; i++){
			sum += a[i];
		}
		double avg = sum*1.0/a.length;
		*/
		int max=a[0], min=a[0], sum = 0;
		double avg = 0;
		for(int i=0; i<a.length; i++){
			if(a[i]>max){
				max = a[i];
			}
			if(a[i]<min){
				min = a[i];
			}
			sum += a[i];
		}
		avg = sum*1.0/a.length;
		System.out.println("max="+max);
		System.out.println("min="+min);
		System.out.println("avg="+avg);
		System.out.println("sum="+sum);
		
	}
}